package com.xinyi.reactivemvvm.di;

import com.xinyi.reactivemvvm.sources.remote.NeteaseApi;
import com.xinyi.reactivemvvm.sources.remote.impl.NeteaseApiImpl;
import com.xinyi.reactivemvvm.sources.repository.MainRepository;
import com.xinyi.reactivemvvm.sources.repository.impl.MainRepositoryImpl;

import javax.inject.Singleton;

import dagger.Module;
import dagger.Provides;
import dagger.hilt.InstallIn;
import dagger.hilt.components.SingletonComponent;

/**
 * @author 杨耿雷
 * @date 2024/9/23 21:28
 * @description 依赖注入 dependency injection
 */
@Module
@InstallIn(SingletonComponent.class)
public class AppModule {

    @Singleton
    @Provides
    public NeteaseApi provideNeteaseApi() {
        return new NeteaseApiImpl();
    }

    @Singleton
    @Provides
    public MainRepository provideMainRepository(NeteaseApi neteaseApi) {
        return new MainRepositoryImpl(neteaseApi);
    }
}
